function out = frameGradient(x)
[M N P] = size(x);
 out = zeros(M,2*N,P);
 out(1:M,1:N-1,:) = x(1:M,2:N,:) - x(1:M,1:N-1,:);
 out(1:M-1,N+1:2*N,:) = x(2:M,1:N,:) - x(1:M-1,1:N,:);
end

 